//
//  MerchantsStatusViewController.m
//  Findif
//
//  Created by Mac on 2018/11/12.
//  Copyright © 2018年 Cicel Chen. All rights reserved.
//

#import "MerchantsStatusViewController.h"
#import "ApplyforShopViewController.h"

@interface MerchantsStatusViewController ()

@property (nonatomic, weak)UILabel * titleLabel;
@property (nonatomic, weak)UILabel * failLabel;
@property (nonatomic, weak)UIButton * repayButton;

@end

@implementation MerchantsStatusViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    self.view.backgroundColor = ZRWhiteColor;
    
    [self setupNav];
    [self setupUI];
}

- (void)setupNav{
    
    self.title = @"店铺入驻申请";
    
//    UIBarButtonItem *backItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"back(1)"] style:UIBarButtonItemStylePlain target:nil action:nil];
//    
//    self.navigationItem.backBarButtonItem = backItem;
}



- (void)setupUI{
    
    UILabel * titleLabel = [UILabel new];
    
    titleLabel.textColor = [UIColor redColor];
    titleLabel.text = @"未通过原因";
    titleLabel.font = [UIFont boldSystemFontOfSize:20 * SCREENH6];
    titleLabel.textAlignment = NSTextAlignmentCenter;
    
    self.titleLabel = titleLabel;
    
    [self.view addSubview:self.titleLabel];
    
    
    UILabel * failLabel = [UILabel new];
    
    failLabel.textColor = [UIColor redColor];
    failLabel.text = [NSString stringWithFormat:@"%@",self.why_failure];
    failLabel.font = [UIFont systemFontOfSize:15 * SCREENH6];
    failLabel.numberOfLines = 0;
    
    self.failLabel = failLabel;
    
    [self.view addSubview:self.failLabel];
    
    
    UIButton * repayButton = [UIButton new];
    
    [repayButton setTitle:@"重新提交" forState:UIControlStateNormal];
    [repayButton setTitleColor:ZRWhiteColor forState:UIControlStateNormal];
    [repayButton setBackgroundColor:ZRBlackColor];
    repayButton.titleLabel.font = [UIFont systemFontOfSize:17 * SCREENH6];
    [repayButton addTarget:self action:@selector(clickRepayButton) forControlEvents:UIControlEventTouchUpInside];
    repayButton.layer.cornerRadius = 5;
    repayButton.layer.masksToBounds = YES;
    
    self.repayButton = repayButton;
    
    [self.view addSubview:self.repayButton];
}


- (void)viewDidLayoutSubviews{
    
    [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.mas_equalTo(self.view);
        make.top.mas_equalTo(self.view).offset(kStatusBarHeight + kNavHeight + 10 * SCREENH6);
    }];
    
    [self.failLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.leading.mas_equalTo(self.view).offset(15 * SCREENH6);
        make.trailing.mas_equalTo(self.view).offset(-15 * SCREENH6);
        make.top.mas_equalTo(self.titleLabel.mas_bottom).offset(5 * SCREENH6);
    }];
    
    [self.repayButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.mas_equalTo(self.view);
        make.bottom.mas_equalTo(self.view).offset(-kTabBarHeight - 50 * SCREENH6);
        make.height.mas_equalTo(40 * SCREENH6);
        make.width.mas_equalTo(250 * SCREENH6);
    }];
}


- (void)clickRepayButton{
    
    HiddenBar;
    
    ApplyforShopViewController * applyVC = [ApplyforShopViewController new];
    
    [self.navigationController pushViewController:applyVC animated:YES];
}


@end
